package com.bkhc.product.strategy;

import com.bkhc.common.enu.PriceModeEnum;
import com.bkhc.product.entity.BrandGoodPrice;
import com.bkhc.product.entity.PriceMode;
import com.bkhc.product.entity.PriceRule;
import com.bkhc.product.entity.ProductPrice;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

@Service
public class CalculatePriceService {

    private PriceStrategy priceStrategy;

    public void calculatePrice(List<PriceRule> rules, Map<String, BrandGoodPrice> brandGoodPriceMap){
        for(PriceRule rule:rules){
            BrandGoodPrice brandGoodPrice = brandGoodPriceMap.get(rule.getIndentity());
            if(brandGoodPrice==null){

            }
            //是否固定值
            String fixFlag = rule.getRelateWay();
            if("1".equals(fixFlag)){
                //Double price = rule.getFixPrice();

            }else {
                priceStrategy = new RatioPriceStrategy();
            }
            priceStrategy.calculatePrice(rule,brandGoodPriceMap.get(rule.getRelateObj()));
        }
    }

}
